<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="待结算账单" name="first"></el-tab-pane>
      <el-tab-pane label="未结算账单" name="second"></el-tab-pane>
      <!--<el-select v-model="page._filter_eq_status" placeholder="资金状态" size="small">-->
        <!--<el-option-->
          <!--v-for="item,index in moneyOptions"-->
          <!--:key="index"-->
          <!--:label="item.name"-->
          <!--:value="item.id">-->
        <!--</el-option>-->
      <!--</el-select>-->
      <!--<el-button @click="search" size="small">搜索</el-button>-->
      <el-table
        v-loading="loading"
        element-loading-text="Loading"
        highlight-current-row
        row-class-name="ele-table-row"
        :data="tableData"
        style="width: 100%">
        <el-table-column label="序号" width="60">
          <template slot-scope="scope">
            {{scope.$index + 1 + 10 * (page.number - 1)}}
          </template>
        </el-table-column>
        <el-table-column label="日期" min-width="100" show-overflow-tooltip>
          <template slot-scope="scope">
            {{scope.row.saveTime}}
          </template>
        </el-table-column>
        <el-table-column label="实际收入" min-width="100" show-overflow-tooltip>
          <template slot-scope="scope">
            ￥{{scope.row.amount}}
          </template>
        </el-table-column>
        <el-table-column label="实际收入" min-width="100" show-overflow-tooltip>
          <template slot-scope="scope">
            {{scope.row.amount}}
          </template>
        </el-table-column>
        <el-table-column label="操作" min-width="100" show-overflow-tooltip>
          <template slot-scope="scope">
            <!--{{scope.row.}}-->
          </template>
        </el-table-column>
      </el-table>
    </el-tabs>
  </div>
</template>

<script>
  import { page } from '@/mixins/page'
  import { money_list_page } from '@/api'

  export default {
    mixins: [page],
    data() {
      return {
        moneyOptions: [
          { id: 1, name: '待结算' },
          { id: 2, name: '已结算' }
        ],
        loading: true,
        tableData: [],
        value: {},
        activeName: 'first',
        page: {
          _filter_eq_status: 1
        }
      }
    },
    methods: {
      handleClick(tab, event) {
        // console.log(tab)
        if (tab.name === 'first') {
          this.page._filter_eq_status = 1
        } else if (tab.name === 'second') {
          this.page._filter_eq_status = 2
        }
        this.getInfo()
      },
      search() {
        this.getInfo()
      },
      getInfo() {
        money_list_page(this.page).then(res => {
          console.log(res)
          this.tableData = res.content
          this.page.total = res.totalElements
          this.loading = false
        })
      }
    },
    mounted() {
      this.getInfo()
    }
  }
</script>
